﻿using Northwind.Interfaces;

namespace Northwind.Application
{
    public class Core : ICore
    {
        private static ICore _instance;
        public static ICore Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance =
                        new Core(new NinjectFactory());
                }
                return _instance;
            }
            internal set { _instance = value; }
        }

        private INorthwindManager _northwindManager;
        public INorthwindManager NorthwindManager
        {
            get
            {
                if (_northwindManager == null)
                {
                    _northwindManager 
                        = Factory.Get<INorthwindManager>();
                }
                return _northwindManager;
            }
        }

        public IFactory Factory { get; internal set; }

        //TODO: constructor should be private for singleton implementation
        private Core(IFactory factory)
        {
            Factory = factory;
        }
    }
}
